package cn.gd.service.frequentlyUsedURLs;

import cn.gd.mapper.frequentlyUsedURLs.FrequentlyUsedURLsMapper;
import cn.gd.pojo.FrequentlyUsedURLs;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
 public class FrequentlyUsedURLsServiceImpl implements FrequentlyUsedURLsService{
    @Autowired
    private FrequentlyUsedURLsMapper mapper;


    @Override
    public PageInfo<FrequentlyUsedURLs> queryFrequentlyUsedURLs(Integer pageNum, Integer pageSize, Integer userID) {
        PageHelper.startPage(pageNum, pageSize);
        return new PageInfo<>(mapper.queryFrequentlyUsedURLs(userID));
    }

    @Override
    public Boolean updateFrequentlyUsedURLsById(FrequentlyUsedURLs frequentlyUsedURLs) {
        return mapper.updateFrequentlyUsedURLsById(frequentlyUsedURLs)>0;
    }

    @Override
    public Boolean deleteFrequentlyUsedURLsById(Integer id) {
        return mapper.deleteFrequentlyUsedURLsById(id)>0;
    }

    @Override
    public Boolean addFrequentlyUsedURLs(FrequentlyUsedURLs frequentlyUsedURLs) {
        return mapper.addFrequentlyUsedRLs(frequentlyUsedURLs)>0;
    }


}
